#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <fcntl.h>

#define LED_ON	0x1001
#define LED_OFF	0x1000

int main(int argc, char** argv)
{
    if(argc != 2)
    {
        printf("usage: %s <on/off>\n",argv[0]);
        return -1;
    }

    int fd = open("/dev/leds", O_RDWR);

    if(strcmp(argv[1],"on") == 0){
        ioctl(fd, LED_ON);
    }else if(strcmp(argv[1], "off") == 0){
        ioctl(fd, LED_OFF);
    }else{
        printf("usage: %s <on/off>\n",argv[0]);
        return -1;
    }

    close(fd);
    
    return 0;
}